package com.yamanyar.weebill.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.yamanyar.weebill.domain.User;

/**
 * Services for User. These services uses data access objects for persistence
 * operations or any kind of calculation that might be needed. Jun 28, 2008
 * 
 * @author Kaan Yamanyar
 */
public interface UserService {

	/**
	 * Persists the given user.
	 * 
	 * @param user
	 */
	@Transactional
	public void createNew(User user);

	/**
	 * 
	 * @return All the users in the system.
	 */
	public List<User> findAll();

	/**
	 * Finds all the users with the given name.
	 * 
	 * @param name
	 * @return
	 */
	public List<User> findByFirstName(String name);

	/**
	 * Returns the user with the given e-mail. Please note that e-mail is an
	 * unique field. It may return null if it can not find an user with such
	 * mail.
	 * 
	 * @param mail
	 *            mail of the user.
	 * @return user user with the given e-mail or null if no such user.
	 */
	public User findByMail(String mail);

	/**
	 * Returns the USER with given ID.
	 * 
	 * @param ID
	 * @return required user.
	 */
	public User getUserWithID(Long id);
}